import { BroadCastCall } from "../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../Framework/MQ/MessageBlock";
import { SActiveListToClient } from "../../../../Message/Public/SActiveListToClient";
import { Cache } from "../../cache/Cache";
import { SActiveToClient } from "../../../../Message/Public/SActiveToClient";
import { EActiveType } from "../../../../Message/Public/EActiveType";
import { NetDispatcher } from "../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../mvc/ServerCommand";
import { DateParser } from "../../../common/tools/DateParser";
import { ClockManager } from "../../manager/ClockManager";
import { Log } from "../../../../com/gengine/debug/Log";
//class ActiveListCommand
    
    export  class ActiveListCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=NaN;
            var loc1=arg1.messageBase as SActiveListToClient;
            Cache.instance.active.updateActives(loc1.actives);
            var loc2=0;
            while (loc2 < loc1.actives.length) 
            {
                loc3 = loc1.actives[loc2] as SActiveToClient;
                if (Cache.instance.active.isActiveInEffectByInfo(loc3)) 
                {
                    if (loc3.code == EActiveType._EActiveTypePeaceField) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.PeaceFieldActiveCommand, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeVIPLoginReward) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.VIPLoginRewardActiveCommand, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeVIPLoginRewardEx) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.VIPLoginRewardActiveCommand, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeRechargeGiftBag) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.RechargeGiftBagActiveCommand, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeToplistCross) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.RankInterFlowerActive, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeConsumeCount || loc3.code == EActiveType._EActiveTypeConsumeCountTwo || loc3.code == EActiveType._EActiveTypeConsumeCountThree) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ConsumeCountActiveCommand, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeConsumeYBRetReward) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ConsumeYBRetRewardActive, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypePrizeFall) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.PrizeFallBegin, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeZazenSameSex) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ZazenSameSexActiveCommand, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeCrazyFish) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.CrazyFishActiveCommand, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeArenaPetDouble) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveArenaPetDouble, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeAddBattleField) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveAddBattleField, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeAddGuildFlame) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveAddGuildFlame, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeAddInterHonour) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveAddInterHonour, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeAddSpa) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveAddSpa, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeAddGuildWar) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveAddGuildWar, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeDramaReward || loc3.code == EActiveType._EActiveTypeDramaMultiDrop) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveDramaReward, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeSunBathPass) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveSunBathPass, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeDramaLotteryBuyTimes) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveDramaLotteryBuyAdd, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeAddArenaMark) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveAddArenaMark, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeAddWrestleMark) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveAddWrestleMark, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeAddTransport) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveAddTransport, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeLoveAddZazen) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveLoveAddZazen, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeMergeRechargeGiftBag) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveMergeRechargeGiftBag, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeNpcAward) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveNpcAward, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeIntegralShopOne) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.IntegralShopActive, {"activeToClient": loc3, "type": 1});
                    }
                    if (loc3.code == EActiveType._EActiveTypeIntegralShopTwo) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.IntegralShopActive, {"activeToClient": loc3, "type": 2});
                    }
                    if (loc3.code == EActiveType._EActiveTypeIntegralShopThree) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.IntegralShopActive, {"activeToClient": loc3, "type": 3});
                    }
                    if (loc3.code == EActiveType._EActiveTypeOldPlayerCallBack) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.RecallOldPlayerActivitiesInfoCommand, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeKingChampionship) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.KingChampionShipActive, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeConsumeDay1 || loc3.code == EActiveType._EActiveTypeConsumeDay2) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ConsumeTodayActiveCommand, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeTwoYearLoginGiveBack) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTwoYearLoginGiveBack, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeTwoYearCrossFlowerCharm) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveCrossFlowerCharm, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypePetAutoExploreMoreIncome) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.EActiveTypePetAutoExploreMoreIncome, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeWuxingDiceOneKey) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveWuxingDiceOneKey, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeRuneFeedOneKey) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveRuneFeedOneKey, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeWuxingSpritOneKey) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveWuxingSpiritOneKey, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeMountAdvanceOneKey) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveMountAdvanceOneKey, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeNewExploreItem) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeNewExploreItem, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeNewIntegralShopItem) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeNewIntegralShopItem, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeHolidayReturnGiftBag) 
                    {
                        loc4 = DateParser.strToDateNormal(loc3.modulus);
                        loc5 = ClockManager.instance.nowDate;
                        loc6 = ClockManager.instance.serverOpenDate * 1000;
                        if (loc4.time > loc6) 
                        {
                            NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeHolidayReturn, loc3);
                        }
                        else 
                        {
                            Log.system("此服开服时间大于" + loc4.getFullYear() + "" + (loc4.getMonth() + 1) + "" + loc4.getDate() + "节日礼包活动不开启");
                        }
                    }
                    if (loc3.code == EActiveType._EActiveTypeHolidaySign) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeHolidaySign, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeSuperFishHook) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeFishHook, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeMarrySameSex) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeMarrySameSex, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeHitEgg) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeHitEgg, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeVipGiftBag360) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeVipGiftBag360, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeRechargeGiftBagEx) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeRechargeGiftBagEx, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeNewDayRecharge1 || loc3.code == EActiveType._EActiveTypeNewDayRecharge2) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeNewDayRecharge, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeNewCumulateRecharge1 || loc3.code == EActiveType._EActiveTypeNewCumulateRecharge2) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeNewAccumulateRecharge, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeActPrevilege) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeActPrevilege, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeDrawPlate) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.LuckAwardsOpenInfo, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeBargainShop) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.DiscountShopInfo, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeChangeCampNoConditions) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.ActiveTypeChangeCampNoConditions, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeDayRechargeReward) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.TimeLimitsGiftInfo, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeSpecialPanicBuy) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.SuperTeamBuyDaysInfo, loc3);
                    }
                    if (loc3.code != EActiveType._EActiveTypeChaosFight) 
                    {
                    };
                    if (loc3.code == EActiveType._EActiveTypeInvestPlan) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.InvestPlanIsOpen, loc3);
                    }
                    if (loc3.code == EActiveType._EActiveTypeRedEnvelope) 
                    {
                        NetDispatcher.dispatchCmd(ServerCommand.NewYearRedPackIsOpen, loc3);
                    }
                }
                ++loc2;
            }
            NetDispatcher.dispatchCmd(ServerCommand.ActiveListChange, null);
            return;
        }
    }
